package com.star.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @Author star
 * @Date 2023/3/12 23:09
 * @PackageName:com.star.system.config
 * @ClassName: MybatisPlusConfig
 * @Description: TODO
 * @Version 1.0
 */
@Configuration
@EnableTransactionManagement
public class MybatisPlusConfig {

    /**
    * @author star
    * @methodname addPaginationInnerInterceptor
    * @date 2023/3/12 23:10
    * 分页插件
    */
    @Bean
    public MybatisPlusInterceptor addPaginationInnerInterceptor(){
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        //向Mybatis过滤器链中添加分页拦截器
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }

}
